package com.gexiaobao.pigeon.ui.dialog

import android.annotation.SuppressLint
import android.content.Context
import android.graphics.Bitmap
import android.text.method.ScrollingMovementMethod
import android.view.LayoutInflater
import android.view.View
import android.widget.ImageView
import androidx.appcompat.widget.AppCompatImageView
import androidx.appcompat.widget.AppCompatTextView
import com.gexiaobao.pigeon.R

/**
 * @author:hxw
 * @date  :2022/12/8
 * @desc  :
 */
class RxDialogScreenShot(context: Context?) : RxDialog(context!!) {

    private lateinit var cancelView: AppCompatTextView
    private lateinit var sureView: AppCompatTextView
    private lateinit var ivScreenShot: AppCompatImageView

    init {
        initView()
    }

    @SuppressLint("MissingInflatedId")
    private fun initView() {
        val dialogView = LayoutInflater.from(context).inflate(R.layout.dialog_screen_shot, null)
        cancelView = dialogView.findViewById(R.id.tv_dialog_cancel)
        sureView = dialogView.findViewById(R.id.tv_dialog_sure)
        ivScreenShot = dialogView.findViewById(R.id.iv_screen_shot)

        cancelView.setOnClickListener {
            dismiss()
        }
        setContentView(dialogView)
    }

    fun setSureListener(listener: View.OnClickListener?) {
        sureView.setOnClickListener(listener)
    }

    fun setCancelListener(listener: View.OnClickListener?) {
        cancelView.setOnClickListener(listener)
    }

    fun setScreenShotImage(bitmap: Bitmap) {
        ivScreenShot.setImageBitmap(bitmap)
    }

}